store data between razor pages

132

store data between razor pages -

//When you redirect somewhere, you can also set this values that will show in the url of
//the next page, you can also send other data, not only strings
public IActionResult OnGet()
{
    return RedirectToPage("Query", new { name1 = "value1"});
}

//Then, inside the onget method you can get the value with an external variable
    public void OnGet(string name)
    {
        Name = name;
    }

Comments

Submit
0 Comments